//auto gen by paipai.java.augogen ver 3.0.0
//author skyzhuang
//source idl: com.erp.gis.idl.GisCoreAo.java


#ifndef ERP_GIS_PO_CMERGEDCOORDINATESPO_BY_AUTOGEN_V5_H
#define ERP_GIS_PO_CMERGEDCOORDINATESPO_BY_AUTOGEN_V5_H


#include "app_platform/intf_serializable.h"
#include <string>
#include <sstream>
#include <iostream>


namespace erp
{
namespace gis
{
namespace po
{


class CMergedCoordinatesPo : public ISerializable
{
	public:
		std::string m_sLastErrMsg;///<错误信息
		/**
		 *  版本号 
		 *
		 * 版本 >= 0
		 */
		uint32_t dwVersion;

		/**
		 * 版本 >= 0
		 */
		uint8_t cVersion_u;

		/**
		 * 经度坐标  x轴
		 *
		 * 版本 >= 0
		 */
		std::string strXPoint;

		/**
		 * 版本 >= 0
		 */
		uint8_t cXPoint_u;

		/**
		 * 维度坐标  y轴
		 *
		 * 版本 >= 0
		 */
		std::string strYPoint;

		/**
		 * 版本 >= 0
		 */
		uint8_t cYPoint_u;

		/**
		 * 信任级别
		 *
		 * 版本 >= 0
		 */
		uint32_t dwTrustLevel;

		/**
		 * 版本 >= 0
		 */
		uint8_t cTrustLevel_u;

		/**
		 * 预留扩展字段 
		 *
		 * 版本 >= 0
		 */
		std::string strReserve;

		/**
		 * 版本 >= 0
		 */
		uint8_t cReserve_u;




	public:
		CMergedCoordinatesPo():
		dwVersion(0),
		cVersion_u(0),
		cXPoint_u(0),
		cYPoint_u(0),
		dwTrustLevel(0),
		cTrustLevel_u(0),
		cReserve_u(0) {}
		CMergedCoordinatesPo& operator = (const CMergedCoordinatesPo& obj){

			this->dwVersion = obj.dwVersion;
			this->cVersion_u = obj.cVersion_u;
			this->strXPoint = obj.strXPoint;
			this->cXPoint_u = obj.cXPoint_u;
			this->strYPoint = obj.strYPoint;
			this->cYPoint_u = obj.cYPoint_u;
			this->dwTrustLevel = obj.dwTrustLevel;
			this->cTrustLevel_u = obj.cTrustLevel_u;
			this->strReserve = obj.strReserve;
			this->cReserve_u = obj.cReserve_u;
			return *this;
		}

	public:


		/**
		 * 是否设置 版本号 了
		 * 
		 * @param uint32_t:dwVersion
		 *  
		 * 
		 */
		 bool  IsVersionSet() const{
				 return  cVersion_u != 0;
		}


		/**
		 * 获取uflag 版本号 了
		 * 
		 * @param uint32_t:dwVersion
		 *  
		 * 
		 */
		 const uint8_t   GetVersionUFlag() const{
				 return  cVersion_u;
		}


		/**
		 * 设置 版本号 
		 * 
		 * @param uint32_t:dwVersion
		 *  
		 * 
		 */
		 void  SetVersion( const uint32_t& sVal, uint8_t cUFlag=1){
				dwVersion = sVal;
				cVersion_u = cUFlag;
		}


		/**
		 * 获取 版本号 
		 * 
		 * @return dwVersion value 类型为:uint32_t
		 * 
		 */
		 const uint32_t&  GetVersion() const {
				return dwVersion;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cVersion_u
		 *  
		 * 
		 */
		 void  SetVersion_u( const uint8_t& sVal){
				cVersion_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cVersion_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetVersion_u() const {
				return cVersion_u;
		}


		/**
		 * 是否设置经度坐标  x轴了
		 * 
		 * @param std::string:strXPoint
		 *  
		 * 
		 */
		 bool  IsXPointSet() const{
				 return  cXPoint_u != 0;
		}


		/**
		 * 获取uflag经度坐标  x轴了
		 * 
		 * @param std::string:strXPoint
		 *  
		 * 
		 */
		 const uint8_t   GetXPointUFlag() const{
				 return  cXPoint_u;
		}


		/**
		 * 设置经度坐标  x轴
		 * 
		 * @param std::string:strXPoint
		 *  
		 * 
		 */
		 void  SetXPoint( const std::string& sVal, uint8_t cUFlag=1){
				strXPoint = sVal;
				cXPoint_u = cUFlag;
		}


		/**
		 * 获取经度坐标  x轴
		 * 
		 * @return strXPoint value 类型为:std::string
		 * 
		 */
		 const std::string&  GetXPoint() const {
				return strXPoint;
		}


		/**
		 * 获取经度坐标  x轴
		 * 
		 * @return strXPoint value 类型为:std::string
		 * 
		 */
		 std::string&  GetXPoint() {
				return strXPoint;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cXPoint_u
		 *  
		 * 
		 */
		 void  SetXPoint_u( const uint8_t& sVal){
				cXPoint_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cXPoint_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetXPoint_u() const {
				return cXPoint_u;
		}


		/**
		 * 是否设置维度坐标  y轴了
		 * 
		 * @param std::string:strYPoint
		 *  
		 * 
		 */
		 bool  IsYPointSet() const{
				 return  cYPoint_u != 0;
		}


		/**
		 * 获取uflag维度坐标  y轴了
		 * 
		 * @param std::string:strYPoint
		 *  
		 * 
		 */
		 const uint8_t   GetYPointUFlag() const{
				 return  cYPoint_u;
		}


		/**
		 * 设置维度坐标  y轴
		 * 
		 * @param std::string:strYPoint
		 *  
		 * 
		 */
		 void  SetYPoint( const std::string& sVal, uint8_t cUFlag=1){
				strYPoint = sVal;
				cYPoint_u = cUFlag;
		}


		/**
		 * 获取维度坐标  y轴
		 * 
		 * @return strYPoint value 类型为:std::string
		 * 
		 */
		 const std::string&  GetYPoint() const {
				return strYPoint;
		}


		/**
		 * 获取维度坐标  y轴
		 * 
		 * @return strYPoint value 类型为:std::string
		 * 
		 */
		 std::string&  GetYPoint() {
				return strYPoint;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cYPoint_u
		 *  
		 * 
		 */
		 void  SetYPoint_u( const uint8_t& sVal){
				cYPoint_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cYPoint_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetYPoint_u() const {
				return cYPoint_u;
		}


		/**
		 * 是否设置信任级别了
		 * 
		 * @param uint32_t:dwTrustLevel
		 *  
		 * 
		 */
		 bool  IsTrustLevelSet() const{
				 return  cTrustLevel_u != 0;
		}


		/**
		 * 获取uflag信任级别了
		 * 
		 * @param uint32_t:dwTrustLevel
		 *  
		 * 
		 */
		 const uint8_t   GetTrustLevelUFlag() const{
				 return  cTrustLevel_u;
		}


		/**
		 * 设置信任级别
		 * 
		 * @param uint32_t:dwTrustLevel
		 *  
		 * 
		 */
		 void  SetTrustLevel( const uint32_t& sVal, uint8_t cUFlag=1){
				dwTrustLevel = sVal;
				cTrustLevel_u = cUFlag;
		}


		/**
		 * 获取信任级别
		 * 
		 * @return dwTrustLevel value 类型为:uint32_t
		 * 
		 */
		 const uint32_t&  GetTrustLevel() const {
				return dwTrustLevel;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cTrustLevel_u
		 *  
		 * 
		 */
		 void  SetTrustLevel_u( const uint8_t& sVal){
				cTrustLevel_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cTrustLevel_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetTrustLevel_u() const {
				return cTrustLevel_u;
		}


		/**
		 * 是否设置预留扩展字段 了
		 * 
		 * @param std::string:strReserve
		 *  
		 * 
		 */
		 bool  IsReserveSet() const{
				 return  cReserve_u != 0;
		}


		/**
		 * 获取uflag预留扩展字段 了
		 * 
		 * @param std::string:strReserve
		 *  
		 * 
		 */
		 const uint8_t   GetReserveUFlag() const{
				 return  cReserve_u;
		}


		/**
		 * 设置预留扩展字段 
		 * 
		 * @param std::string:strReserve
		 *  
		 * 
		 */
		 void  SetReserve( const std::string& sVal, uint8_t cUFlag=1){
				strReserve = sVal;
				cReserve_u = cUFlag;
		}


		/**
		 * 获取预留扩展字段 
		 * 
		 * @return strReserve value 类型为:std::string
		 * 
		 */
		 const std::string&  GetReserve() const {
				return strReserve;
		}


		/**
		 * 获取预留扩展字段 
		 * 
		 * @return strReserve value 类型为:std::string
		 * 
		 */
		 std::string&  GetReserve() {
				return strReserve;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cReserve_u
		 *  
		 * 
		 */
		 void  SetReserve_u( const uint8_t& sVal){
				cReserve_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cReserve_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetReserve_u() const {
				return cReserve_u;
		}

		virtual bool Serialize(CByteStreamNetwork& bs){
		
			uint32_t dwMyLen = 0;
			if(bs.isStoring()) //for write in buffer
			{
				//can not larger than 1 M.
				CByteStreamNetwork bsDummy(NULL, 1024 * 1024, false);
				//bsDummy for precheck the xo size...
				bsDummy.isStoring(true);
				Serialize_i(bsDummy);
				dwMyLen = bsDummy.getWrittenLength();
				bs & dwMyLen;
				Serialize_i(bs);
			}
			else
			{    //for read from buffer
				bs & dwMyLen;
				uint32_t dwReadedLen = bs.getReadLength();
				Serialize_i(bs);
				dwReadedLen = bs.getReadLength() - dwReadedLen;
				// dwReadedLen for the size of xo
				if( dwReadedLen > dwMyLen ){
					return false;
				}
				//go through the unwanted mem position...
				bs.goForward( dwMyLen - dwReadedLen );
			}

			return bs.isGood();
		}

		bool Serialize_i(CByteStreamNetwork& bsTmp){

			uint32_t dwVersionTmp = dwVersion;
			bsTmp & dwVersionTmp; // 序列化 版本号  类型为uint32_t
			bsTmp & cVersion_u; // 序列化 类型为uint8_t
			bsTmp & strXPoint; // 序列化经度坐标  x轴 类型为String
			bsTmp & cXPoint_u; // 序列化 类型为uint8_t
			bsTmp & strYPoint; // 序列化维度坐标  y轴 类型为String
			bsTmp & cYPoint_u; // 序列化 类型为uint8_t
			bsTmp & dwTrustLevel; // 序列化信任级别 类型为uint32_t
			bsTmp & cTrustLevel_u; // 序列化 类型为uint8_t
			bsTmp & strReserve; // 序列化预留扩展字段  类型为String
			bsTmp & cReserve_u; // 序列化 类型为uint8_t
			return bsTmp.isGood();
		}

		const char* GetLastErrMsg() const{
			return m_sLastErrMsg.c_str();
		}

		bool VerifyMergedCoordinatesPo(){

			if(!IsVersionSet()){
				m_sLastErrMsg = "Miss Param:version";
				return false;
			}

			if(!IsXPointSet()){
				m_sLastErrMsg = "Miss Param:xPoint";
				return false;
			}

			if(!IsYPointSet()){
				m_sLastErrMsg = "Miss Param:yPoint";
				return false;
			}

			if(!IsTrustLevelSet()){
				m_sLastErrMsg = "Miss Param:trustLevel";
				return false;
			}

			if(!IsReserveSet()){
				m_sLastErrMsg = "Miss Param:reserve";
				return false;
			}
			return true;
		}

		void DumpData(std::ostream& oss) const{
		
			oss<<"[dwVersion:"<<dwVersion<<"] ";
			oss<<"[cVersion_u:"<<(int)cVersion_u<<"] ";
			oss<<"[strXPoint:"<<strXPoint<<"] ";
			oss<<"[cXPoint_u:"<<(int)cXPoint_u<<"] ";
			oss<<"[strYPoint:"<<strYPoint<<"] ";
			oss<<"[cYPoint_u:"<<(int)cYPoint_u<<"] ";
			oss<<"[dwTrustLevel:"<<dwTrustLevel<<"] ";
			oss<<"[cTrustLevel_u:"<<(int)cTrustLevel_u<<"] ";
			oss<<"[strReserve:"<<strReserve<<"] ";
			oss<<"[cReserve_u:"<<(int)cReserve_u<<"] ";
		
		}

		// codydeng提供,非常好的dump方法 ^-^  。。。。。
		template<typename T>
		T & DumpPlusData(T& oss){
			oss<<"dwVersion:"<<dwVersion;
			oss<<"cVersion_u:"<<cVersion_u;
			oss<<"strXPoint:"<<strXPoint;
			oss<<"cXPoint_u:"<<cXPoint_u;
			oss<<"strYPoint:"<<strYPoint;
			oss<<"cYPoint_u:"<<cYPoint_u;
			oss<<"dwTrustLevel:"<<dwTrustLevel;
			oss<<"cTrustLevel_u:"<<cTrustLevel_u;
			oss<<"strReserve:"<<strReserve;
			oss<<"cReserve_u:"<<cReserve_u;
			return oss;
		}

		// wileywang提供,树形dump方法 ^-^  。。。。。
		void DumpDataTree(std::ostream& os, int ident = 0)const {
			g_pprint(os, "dwVersion", dwVersion, ident);
			g_pprint(os, "cVersion_u", cVersion_u, ident);
			g_pprint(os, "strXPoint", strXPoint, ident);
			g_pprint(os, "cXPoint_u", cXPoint_u, ident);
			g_pprint(os, "strYPoint", strYPoint, ident);
			g_pprint(os, "cYPoint_u", cYPoint_u, ident);
			g_pprint(os, "dwTrustLevel", dwTrustLevel, ident);
			g_pprint(os, "cTrustLevel_u", cTrustLevel_u, ident);
			g_pprint(os, "strReserve", strReserve, ident);
			g_pprint(os, "cReserve_u", cReserve_u, ident);
		}
		
		//提供ToString借口，默认为DumpData格式，请按需要进行修改
		std::string ToString() const{
			std::stringstream ss;
			DumpData(ss);
			return ss.str();
		}

/**
 ********************以下信息是每个版本的字段********************
 */

};

}
}
}

#endif /* ERP_GIS_PO_CMERGEDCOORDINATESPO_BY_AUTOGEN_V5_H */
